package main

/*

./relativize /Users/marius/d/go/src /Users/marius/tmp/foo

*/

import (
	"flag"
	"fmt"
	"os"
	"path"
	"path/filepath"
)

func main() {
	flag.Parse()

	if flag.NArg() != 2 {
		fmt.Fprintf(os.Stderr, "usage: basepath targpath\n")
		os.Exit(1)
	}

	basepath := path.Clean(flag.Args()[0])
	targpath := path.Clean(flag.Args()[1])

	rel, err := filepath.Rel(basepath, targpath)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	fmt.Println(rel)
}
